package com.web.all.common.bean.enums;

import java.util.HashMap;
import java.util.Map;
import java.util.stream.Stream;

/**
 * 统一返回类Code
 * @author lc
 */
public enum ResponseCode {

    ERROR_CODE("8500"),

    SUCCESS_CODE("8200"),

    ERROR_CODE_PARAM("8400");

    public final String code;

    ResponseCode(String code) {
        this.code = code;
    }

    private static Map<String,ResponseCode> codeLoop = new HashMap<>();

    static {
        Stream.of(ResponseCode.values()).forEach(responseCodes -> codeLoop.put(responseCodes.code,responseCodes));
    }

    public static ResponseCode forCode(String code){
        return codeLoop.get(code);
    }
}
